package com.lyz.dataStructure.algorithm.科大讯飞2020;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 10:06
 * @Description:
 **/


import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/7/13 10:06
 *@Description:
 **/
public class 两大数相加 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

               String s1 = sc.next();
               String s2 = sc.next();
               String s = add(s1,s2);
               System.out.println(s);
    }

    private static String add(String str1,String str2){

        if(str1==null||"".equals(str1)){
            return  str2;
        }
        if(str2==null||"".equals(str2)){
            return  str1;
        }
        int maxLength = Math.max(str1.length(),str2.length());
        StringBuffer result = new StringBuffer(maxLength+1);
        str1 =new StringBuffer(str1).reverse().toString();
        str2 =new StringBuffer(str2).reverse().toString();
        int minLength = Math.min(str1.length(),str2.length());

        int currentNum = 0;
        int carry = 0;
        int i =0;
        for(;i<minLength;i++){
            currentNum = str1.charAt(i)+str2.charAt(i)-2*'0'+carry;
            carry = currentNum/10;
            currentNum = currentNum%10;
            result.append(String.valueOf(currentNum));
        }
        if(str1.length()<str2.length()){
            str1 =str2;
        }
        for(;i<str1.length();i++){
            currentNum = str1.charAt(i)-'0'+carry;
            carry = currentNum/10;
            currentNum%=10;
            result.append(String.valueOf(currentNum));
        }
        if(carry>0){
            result.append(String.valueOf(carry));
        }
        return  result.reverse().toString();
    }
}
